/**
 * 郭楠project
 * com.gn.micblog.controller
 * MainController.java
 * 创建人:TonyGuo 
 * 时间：2016年6月5日-上午11:21:33 
 * 2016Tm公司-版权所有
 */
package com.gn.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.gn.service.AdminUserService;

/**
 * 
 * MainController
 * 创建人:TonyGuo
 * 时间：2016年6月5日-上午11:21:33 
 * @version 1.0.0
 * 
 */
@Controller
@RequestMapping(value=("/"))
public class MainController {
	@Resource
	private AdminUserService adminUserService;
	
	private final Logger logger = LoggerFactory.getLogger(MainController.class);
	
	/**
	 * 指向商品详情页面
	 */
	@RequestMapping("goods/{id}")
	public String goodsDetail(){
		logger.info("goodsDetail..{}","商品详情进入了");
		return "goodsDetail";
	};
	
	/**
	 * 指向测试页面
	 */
	@RequestMapping("user/test.htm")
	public String test(){
		logger.info("test info...{}","测试进入了");
		return "test";
	};
	
	
	/**
	 * 登录
	 */
	@RequestMapping("user/login.htm")
	public String login(){
		logger.info("login info...{}","登录进入了");
		return "login";
	};
	
	/**
	 * 注册
	 */
	@RequestMapping("user/signup.htm")
	public String signup(){
		logger.info("signup info...{}","进入注册页面了");
		return "signup";
	};
	
	/**
	 * 【退出登录】
	 * */
	@RequestMapping("user/logout")
	public String logOut(HttpServletRequest req){
		req.getSession().invalidate();
		return "redirect:list.htm";
	}
	
	
	/**
	 * 【跳转到支付页面】
	 */
	@RequestMapping(value="user/pay.htm",method=RequestMethod.GET)
	public String toPay(HttpServletRequest req){
		return "pay";
	}
	
	/**
	 * @param page--当前页
	 * @return String
	 */
	@RequestMapping(value="user/list.htm",method=RequestMethod.GET)
	public String findByRecords(HttpServletRequest req){
		
		return "list";
	}
	
	/**
	 * @param page-评论页
	 * @return String
	 */
	@RequestMapping(value="user/comment.htm/{gid}",method=RequestMethod.GET)
	public String userComment(HttpServletRequest req,@PathVariable("gid") String gid){
		req.getSession().setAttribute("curr_goodsid", gid);
		return "comment";
	}
	
	/**
	 * @param page-收藏页
	 * @return String
	 */
	@RequestMapping(value="user/my_favorites.htm",method=RequestMethod.GET)
	public String userCollect(HttpServletRequest req){
		
		return "my_favorites";
	}
	
	
	/**
	 * @param 小程序导航
	 * @return String
	 */
	@RequestMapping(value="user/xcx_nav.htm",method=RequestMethod.GET)
	public String xcxNav(HttpServletRequest req,String uid){
		
		return "xcx_nav";
	}
	
	/**
	 * @param 小程序商店
	 * @return String
	 */
	@RequestMapping(value="user/xcx_market.htm",method=RequestMethod.GET)
	public String xcxMarket(HttpServletRequest req){
		
		return "xcx_market";
	}
	
	/**管理后台-小程序添加*/
	@RequestMapping(value="user/ms_xcx_add.htm",method=RequestMethod.GET)
	public String msXcxAdd(HttpServletRequest req){
		
		return "ms_xcx_add";
	}
	
	/**test emp*/
	@RequestMapping(value="user/emp",method=RequestMethod.GET)
	public String emp(HttpServletRequest req){
		
		return "testemp";
	}
	
}
